package com.ruoyi.shop.popularize.rules.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.common.mapper.DtsGrouponRulesMapper;
import com.ruoyi.mall.common.domain.DtsGrouponRules;
import com.ruoyi.shop.popularize.rules.service.IDtsGrouponRulesService;

/**
 * 团购规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-02-19
 */
@Service
public class DtsGrouponRulesServiceImpl implements IDtsGrouponRulesService 
{
    @Autowired
    private DtsGrouponRulesMapper dtsGrouponRulesMapper;

    /**
     * 查询团购规则
     * 
     * @param id 团购规则主键
     * @return 团购规则
     */
    @Override
    public DtsGrouponRules selectDtsGrouponRulesById(Long id)
    {
        return dtsGrouponRulesMapper.selectDtsGrouponRulesById(id);
    }

    /**
     * 查询团购规则列表
     * 
     * @param dtsGrouponRules 团购规则
     * @return 团购规则
     */
    @Override
    public List<DtsGrouponRules> selectDtsGrouponRulesList(DtsGrouponRules dtsGrouponRules)
    {
        return dtsGrouponRulesMapper.selectDtsGrouponRulesList(dtsGrouponRules);
    }

    /**
     * 新增团购规则
     * 
     * @param dtsGrouponRules 团购规则
     * @return 结果
     */
    @Override
    public int insertDtsGrouponRules(DtsGrouponRules dtsGrouponRules)
    {
        return dtsGrouponRulesMapper.insertDtsGrouponRules(dtsGrouponRules);
    }

    /**
     * 修改团购规则
     * 
     * @param dtsGrouponRules 团购规则
     * @return 结果
     */
    @Override
    public int updateDtsGrouponRules(DtsGrouponRules dtsGrouponRules)
    {
        dtsGrouponRules.setUpdateTime(DateUtils.getNowDate());
        return dtsGrouponRulesMapper.updateDtsGrouponRules(dtsGrouponRules);
    }

    /**
     * 批量删除团购规则
     * 
     * @param ids 需要删除的团购规则主键
     * @return 结果
     */
    @Override
    public int deleteDtsGrouponRulesByIds(Long[] ids)
    {
        return dtsGrouponRulesMapper.deleteDtsGrouponRulesByIds(ids);
    }

    /**
     * 删除团购规则信息
     * 
     * @param id 团购规则主键
     * @return 结果
     */
    @Override
    public int deleteDtsGrouponRulesById(Long id)
    {
        return dtsGrouponRulesMapper.deleteDtsGrouponRulesById(id);
    }
}
